<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>大奔农庄</title>
    <link rel="stylesheet" type="text/css" href="css/api.css"/>
    <link rel="stylesheet" type="text/css" href="css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>    
    <link rel="stylesheet" href="css/swiper.min.css">
     <link rel="stylesheet" href="font/iconfont.css">
</head>
<body>
	<div class="aui-content" style="z-ident:9999;">
		<footer class="aui-bar aui-bar-tab" id="footer" style="line-height:0.9rem;height: 55px; border-top: 1px #ddd solid;">
			<div class="aui-bar-tab-item aui-active" tapmode onclick="randomSwitchBtn(this,'shangcheng',0)">
		        <i class="iconfont icon-iconfonticonfonticonfont20"></i>
		        <div class="aui-bar-tab-label">商城</div>
		    </div>
		    <div class="aui-bar-tab-item" tapmode onclick="randomSwitchBtn(this,'shop-car',1)">
		        <i class="iconfont icon-gouwuche"></i>
		        <div class="aui-bar-tab-label">购物车</div>
		    </div>
		    <div class="aui-bar-tab-item" tapmode onclick="randomSwitchBtn(this,'dingdan',2)">
		       <i class="iconfont icon-dingdan"></i>
		        <div class="aui-bar-tab-label">订单</div>
		    </div>
		    <div class="aui-bar-tab-item" tapmode onclick="randomSwitchBtn(this,'user',3)">
		        <i class="iconfont icon-wode"></i>
		        <div class="aui-bar-tab-label">我的</div>
		    </div>
		</footer>
	</div>	
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
	var main_h;
	var frames = [
		{name : 'frm_shangcheng',url : 'html/frame/shangcheng.html',bounces: false,reload: false,pro:false},
		{name : 'frm_cart',url : 'html/frame/cart.html',bounces: false,reload: false,pro:false},
		{name : 'frm_order',url : 'html/frame/order.html',bounces: false,reload: false,pro:false},
		{name : 'frm_user',url : 'html/frame/user.html',bounces: false,reload: false,pro:false}
	];
	var db_key = 'user',db_user;
    apiready = function(){
/*
        db_user = $api.getStorage(db_key);
        try {
            if (db_user.islogin && db_user.mytoken) {
                
            }else {
                db_user = {islogin: false};
                $api.setStorage(db_key,db_user);
                openLogin();
            }
        }catch(e) {
            db_user = {islogin: false};
            $api.setStorage(db_key,db_user);
            openLogin();
        }
 */       
        api.setStatusBarStyle({
            style: 'light'
        });
        var body_h = $api.offset($api.dom('body')).h;
        var footer_h = $api.offset($api.byId('footer')).h;
        main_h = body_h - footer_h; 
        api.openFrame({
            name: 'frm_shangcheng',
            url: 'html/frame/shangcheng.html',
            bounces: false,
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: main_h
            }
        })
    };
    // 随意切换按钮
	function randomSwitchBtn(obj, name, index) {	
		var $footerMenu = $api.domAll(".aui-bar-tab-item");
		
		for (var j = 0; j < $footerMenu.length; j++) {
			$api.removeCls($footerMenu[j], 'aui-active');
		}
		$api.addCls(obj, 'aui-active');
	
		api.openFrame({
			name: frames[index].name,
			url : frames[index].url,
			scrollEnabled: false,
			bounces: frames[index].bounces,
			rect: {x: 0, y: 0, w: 'auto', h: main_h},
			showProgress: frames[index].pro,
			reload: frames[index].reload,
			bgColor: '#fff',
			//animation: 'push'
		});
	}
</script>    
</html>